cc.Class({
    extends: cc.Component,

    properties: {
        gamechoosemode_perfab: cc.Prefab,
    },

    onLoad: function () {
        //屏蔽底部点击事件
        cc.find('mask', this.node).on(cc.Node.EventType.TOUCH_START, function (event) {});
        
        var choosepeople_node = cc.find("choosepeople_bg", this.node);
        choosepeople_node.scale = 0;
        choosepeople_node.runAction(cc.scaleTo(0.3, 1, 1));
    },

    //选择三人场
    onThreePeopleRoom: function () {
        var gamechoosemode = cc.instantiate(this.gamechoosemode_perfab);
        gamechoosemode.getComponent("gamechoosemode_component").peoplemode = 0;
        this.node.parent.addChild(gamechoosemode);
        this.onClose();
    },
    
    //选择四人场
    onFourPeopleRoom: function () {
        var gamechoosemode = cc.instantiate(this.gamechoosemode_perfab);
        gamechoosemode.getComponent("gamechoosemode_component").peoplemode = 1;
        this.node.parent.addChild(gamechoosemode);
        this.onClose();
    },
    
    //关闭
    onClose: function () {
        var choosepeople_node = cc.find("choosepeople_bg", this.node);
        choosepeople_node.runAction(cc.sequence(
            cc.scaleTo(0.3, 0, 0), 
            cc.callFunc(this.exitThisNode, this)
            ));
    },
    
    //删除当前节点
    exitThisNode: function () {
        this.node.destroy();
    },
});
